{php}
    $path_type = isset($field['options']['path_type'])? $field['options']['path_type']:'picture';
{/php}
<style type="text/css">
/*多图上传*/
.gallery-box-bg{background-color: #f0f0f0;padding: 10px 5px;margin-left:10px;}

.uploader-list .col-md-3{padding-left:5px;padding-right: 5px;}
.uploader-list .thumbnail{width: 100%;height: 135px;margin-bottom: 15px;}
.uploader-list .thumbnail img{max-width: 100%;height: 100%;}
</style>
<div class="controls pictures">
    <div class="" style="padding-bottom: 5px;">
        <span class="btn btn-info ml-10 btn-sm" data-url="{:url('admin/Upload/attachmentLayer',['input_id_name'=>$field['id'],'path_type'=>$path_type,'gettype'=>'multiple'])}" data-gettype="multiple" onclick="openAttachmentLayer(this);"><i class="fa fa-photo"></i> 选择多图</span>
        <input class="attach" type="hidden" id="{$field.id}" name="{$field.name}" value="{$field.value|default=''}"/>
    </div>
    {notempty name="field.tip"}<div class="help-block col-md-10 fn" style="color:#E74C3C;padding-left: 20px;">{$field.tip}</div>{/notempty}
    <div id="{$field.id}-gallery-box" class="uploader-list col-md-10 img-box {notempty name="field.value"}gallery-box-bg{/notempty}">
       {notempty name="images"}
            {foreach name="images" item="img"}
                {notempty name="img"}
                    <div class="col-md-3">
                        <div class="thumbnail">
                        <i class="fa fa-times-circle remove-attachment"></i>
                        <img class="img" src="{$img|get_image=###}" data-id="{$img}">
                        </div>
                    </div>
                {/notempty}
            {/foreach}
        {/notempty}
    </div>
</div>
<script>
$(function () {
    // 删除图片
    $('body').on('click', '#{$field.id}-gallery-box .remove-attachment', function() {
        var ready_for_remove_id = $(this).closest('.thumbnail').find('img').attr('data-id'); //获取待删除的图片ID
        if (!ready_for_remove_id) {
            updateAlert('错误', 'danger');
        }
        var current_picture_ids = $('#{$field.id}').val().split(","); //获取当前图集以逗号分隔的ID并转换成数组
        current_picture_ids.splice($.inArray(ready_for_remove_id,current_picture_ids),1); //从数组中删除待删除的图片ID
        $('#{$field.id}').val(current_picture_ids.join(',')) //删除后覆盖原input的值
        $(this).closest('.col-md-3').remove(); //删除图片预览图
    });

})
</script>